#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=2e5+1000;
typedef long long LL;
inline LL read(){LL x=0,f=1;char ch=getchar();	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
set<LL>s;
map<LL,vector<LL>>map1;
int main(void){
   	cin.tie(0);std::ios::sync_with_stdio(false);
    LL T;cin>>T;
    while(T--){
        LL n;cin>>n;
        s.clear();map1.clear();
        for(LL i=1;i<=n;i++){
            LL l,r;cin>>l>>r;
            s.insert(l);
            map1[l].push_back(r);
        }
        s.insert(1e9+10);
        LL i=*s.begin();
        priority_queue< LL ,vector<LL>,greater<LL> >que;
        bool flag=true;
        while(i<=1e9){
            for(auto &j : map1[i]){
                que.push({j});
            }
            LL now=que.top();que.pop();
            if(que.empty()){
                i=(*s.lower_bound(i+1));
            }
            else{
                if(i>=que.top()){
                    flag=false;break;
                }
                i++;
            }
        }
        if(flag){
            cout<<"Yes"<<"\n";
        }
        else{
            cout<<"No"<<"\n";
        }
    }
   	return 0;
}
